package com.zr.bookcorner.adapter;

import android.view.View;
import android.widget.ImageView;
import com.zh.baselibrary.base.BaseRecyclerAdapter;
import com.zh.baselibrary.utils.BitmapHelp;
import com.zh.model.manager.BookInfo;
import com.zr.bookcorner.R;

import java.util.List;

public class BookSelectAdapter extends BaseRecyclerAdapter<BookInfo> {
    public BookSelectAdapter(List<BookInfo> mData) {
        super(mData);
    }

    @Override
    protected int getLayoutId(int viewType) {
        return R.layout.item_book_select;
    }

    @Override
    protected void bindData(BaseViewHolder holder, int position, BookInfo bookInfo) {
        BitmapHelp.display((ImageView) holder.getView(R.id.iv_url), bookInfo.getImageUrl(), false, R.mipmap.cover_small);
        setItemText(holder.getView(R.id.tv_auther), bookInfo.getAuthor());
        setItemText(holder.getView(R.id.tv_book_name), bookInfo.getBookName());
        holder.getView(R.id.tv_status).setTag(bookInfo.getCabinetNum()+"");
        holder.getView(R.id.tv_status).setOnClickListener((View.OnClickListener) mContext);
    }
}
